From a6daba5e78df967258ca8998a8ec535be0746232 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 25 May 2011 22:21:15 +0200 Subject: [PATCH] API: Change semantics of gtk_container_get_child_path() Include the child widget path in the returned path now. This allows customizing the path of the current widgets - like adding flags to child widgets (and maybe siblings in the future). --- gtk/gtkcontainer.c | 4 +++- gtk/gtkframe.c | 4 +++- gtk/gtknotebook.c | 7 ++++--- gtk/gtktreeview.c | 2 ++ gtk/gtkwidget.c | 4 ++-- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c index 50a4514448..4b27fd6210 100644 --- a/gtk/gtkcontainer.c +++ b/gtk/gtkcontainer.c @@ -2334,6 +2334,8 @@ gtk_container_real_get_path_for_child (GtkContainer *container, g_list_free_1 (cur); } + gtk_widget_path_append_for_widget (path, child); + return path; } @@ -3362,7 +3364,7 @@ _gtk_container_get_reallocate_redraws (GtkContainer *container) * @child: a child of @container * * Returns a newly created widget path representing all the widget hierarchy - * from the toplevel down to @child (this one not being included). + * from the toplevel down to and including @child. * * Returns: A newly created #GtkWidgetPath **/ diff --git a/gtk/gtkframe.c b/gtk/gtkframe.c index 5f201cce18..f0a42ed953 100644 --- a/gtk/gtkframe.c +++ b/gtk/gtkframe.c @@ -384,7 +384,9 @@ gtk_frame_get_path_for_child (GtkContainer *container, path = GTK_CONTAINER_CLASS (gtk_frame_parent_class)->get_path_for_child (container, child); if (child == priv->label_widget) - gtk_widget_path_iter_add_class (path, -1, GTK_STYLE_CLASS_FRAME); + gtk_widget_path_iter_add_class (path, + gtk_widget_path_length (path) - 2, + GTK_STYLE_CLASS_FRAME); return path; } diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index 88835d3e34..8cb21a70db 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -4454,7 +4454,6 @@ gtk_notebook_get_path_for_child (GtkContainer *container, GtkNotebook *notebook; GtkNotebookPage *page; GtkWidgetPath *path; - GtkRegionFlags flags; GList *c; path = GTK_CONTAINER_CLASS (gtk_notebook_parent_class)->get_path_for_child (container, widget); @@ -4474,8 +4473,10 @@ gtk_notebook_get_path_for_child (GtkContainer *container, if (!c) return path; - flags = _gtk_notebook_get_tab_flags (notebook, page); - gtk_widget_path_iter_add_region (path, -1, GTK_STYLE_REGION_TAB, flags); + gtk_widget_path_iter_add_region (path, + gtk_widget_path_length (path) - 2, + GTK_STYLE_REGION_TAB, + _gtk_notebook_get_tab_flags (notebook, page)); return path; } diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 912b0fb064..3a003b708f 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -8540,6 +8540,8 @@ gtk_tree_view_get_path_for_child (GtkContainer *container, break; } + gtk_widget_path_append_for_widget (path, child); + return path; } diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 9a598107da..340dd9ef00 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -14312,10 +14312,10 @@ gtk_widget_get_path (GtkWidget *widget) * situation. */ widget->priv->path = gtk_widget_path_new (); + + gtk_widget_path_append_for_widget (widget->priv->path, widget); } - gtk_widget_path_append_for_widget (widget->priv->path, widget); - if (widget->priv->context) gtk_style_context_set_path (widget->priv->context, widget->priv->path); -- 2.30.2